// Twitter_test.cpp : Defines the entry point for the console application.
//
//
//#include "MyInclude.h"
#include "TwitterAPIWrap.h"

const string PATH = "D:/Twitter/";

int main(int argc, char** argv)
{

	////doOauth();
	//SSLInitializer sslInitializer;

	//// Note: we must create the passphrase handler prior Context 
	//SharedPtr<InvalidCertificateHandler> ptrCert = new Poco::Net::AcceptCertificateHandler(false); // ask the user via console
	//Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_RELAXED, 9, true, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
	//SSLManager::instance().initializeClient(0, ptrCert, ptrContext);

	//try
	//{
	//	std::auto_ptr<std::istream> pStr(odTest(doOauth()));
	//	std::string file = PATH + "time_line.txt";
	//	std::ofstream ofs(file.c_str());
	//	StreamCopier::copyStream(*pStr.get(), ofs);
	//}
	//catch(...)
	//{
	//}
	TwitterAPIWrap twitter;
	
	std::string file = PATH + "stream_" + "China" + ".txt";

	std::ofstream ofs(file.c_str());

	ExtractStreamFilterData exta;

	//TwitterFriendFlowerQuery query;
	//query.setScreenName("Twitterapi");
	//query.setCursor("-1");
	//TwitterQuery query;
	//TwitterStreamFilterQuery query;
	//query.setKeys("China");
	TwitterSearchQuery query;
	query.setKeys("from:CNN");

	
	Poco::StreamCopier::copyStream(*twitter.doSearchAPI(&query), cout);
	//exta.doExtractData(*twitter.doStreamSample(&query), cout);
	//exta.doExtractData(*twitter.doStreamTrackAPI(&query), ofs);

	return 0;
}


